package org.smart4j.plugin.security;

import org.apache.shiro.web.env.EnvironmentLoaderListener;

import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import java.util.Set;

/**
 * @author djw E-mail:***@***.com
 * @version 创建时间：2017/10/29 20:59
 */
public class ServletContainerInitializer {
    public void onStartup(Set<Class<?>> handlesTypes, ServletContext servletContext){
        servletContext.setInitParameter("shiroConfigLocations","classpath:smart-security.ini");
        servletContext.addListener(EnvironmentLoaderListener.class);
        FilterRegistration.Dynamic smartSecurityFilter=servletContext.addFilter("SmartSecurityFilter",SmartSecurityFilter.class);
        smartSecurityFilter.addMappingForUrlPatterns(null,false,"/*");
    }
}
